package com.example.android.ouactivity.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.android.ouactivity.R;
import com.example.android.ouactivity.model.MessageSys;

import java.util.List;

/**
 * 系统消息类适配器
 * Created by 庆 on 2016/11/18.
 */

public class SystemMsgAdapter extends RecyclerView.Adapter<SystemMsgHolder> {
    private List<MessageSys> message;
    public SystemMsgAdapter(List<MessageSys> list){
        this.message = list;
    }
    @Override
    public SystemMsgHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_sys_msg,parent,false);
        SystemMsgHolder systemMsgHolder = new SystemMsgHolder(view);
        return systemMsgHolder;
    }

    @Override
    public void onBindViewHolder(SystemMsgHolder holder, int position) {
        holder.title.setText(message.get(position).getTitle());
        holder.content.setText(message.get(position).getContent());
        holder.date.setText(message.get(position).getDate());
    }

    @Override
    public int getItemCount() {
        return message.size();
    }
}
